import { tableOption } from './list_table.config.js'
import search from './../search/search.js';
import { shopCheckPage } from '@/api/shop/storeReport.js'

export default {
    name: "list_table",
    mixins: [search],
    data() {
        return {
            tableOption: tableOption,
            loading: false,
            loadData: [],
            page: {
                total: 0,
                size: 10,
                current: 1,
            },
            btn: [
                {
                    title: "导出",
                    isShow: true
                }
            ],
            searchForm: {},
        }
    },
    methods: {
        getList(searchForm, page) {
            if (searchForm) {
                console.log(searchForm)
                this.searchForm = searchForm
            }
            if (page) {
                this.page.current = page
            }
            shopCheckPage(Object.assign({shopId: this.$store.getters.userInfoMessage.shopId}, this.searchForm, this.page)).then(val=>{
                console.log(val)
                let data = val.data
                this.loadData = data.records
                this.page = {
                    total: data.total,
                    size: data.size,
                    current: data.current,
                  };
            })
            
        },
        onShowSizeChange(current, size) {
            console.log(current, size)
            this.page.current = current
            this.page.size = size
            this.getList()
        },
        handler(index) {
            if (index == 0) {
                this.export1()
            }
        },
        // 删除
        delete() {
            console.log(123321)
        },
        details(item) {
            this.$router.push({ path: '/shop/storeReport/storeReportDetails', query: {shopId:item.shopId, beginTime: this.searchForm.beginTime, endTime: this.searchForm.endTime} })
        },
        export1() {

        }
    }

} 